<%@page import="bean.McTypeBean"%>
<%@page import="dao.impl.McTypeDAOImpl"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	System.out.println(path);
	String basePath = request.getScheme() + "://"
	+ request.getServerName() + ":" + request.getServerPort()
	+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="<%=path%>/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="<%=path%>/bootstrap/css/bootstrap-theme.min.css" />
<script src="<%=path%>/bootstrap/js/bootstrap.min.js"></script>
<style type="text/css">
<!--
td,th {
	font-family: 宋体;
	font-size: 12px;
	color: #000000;
	background-repeat: no-repeat;
	background-position: bottom;
}

td#tdid {
	background-image: url(../img/top_bg.gif);
	background-repeat: repeat-x;
}

body {
	font-family: 宋体;
	font-size: 30px;
	color: #000000;
}

a {
	text-decoration: none;
}
-->
</style>
<%-- <script type="text/javascript" src="<%=path%>/js/selectType.js"></script> --%>
<script type="text/javascript">
	//定义一个XMLHttpRequest对象
	var xmlHttp;
	function createHttpRequest() {
		//IE7+,谷歌,火狐...浏览器
		if (window.XMLHttpRequest) {
			xmlHttp = new XMLHttpRequest();
			//alert("window.XMLHttpRequest");
		} else {
			//window.ActiveXObject;IE5,IE6
			xmlHttp = new ActiveXObject();
			//alert("window.ActiveXObject");
		}
	}
	function fun1() {
		var bigtypeid = document.all.bigType.value;
		var smallType = document.all.smallType;
		smallType.length = 0;
		if (bigtypeid == 0) {
			return;
		}
		createHttpRequest();
		var url = "SelectTypeServlet?bigtypeid=" + bigtypeid + "&date="
				+ new Date().getTime();
		xmlHttp.open("get", url, true);
		//绑定一个javaScript函数，处理请求状态改变
		xmlHttp.onreadystatechange = function() {
			//请求完成
			if (xmlHttp.readyState == 4) {
				//状态码200正常请求响应
				if (xmlHttp.status = 200) {
					var xml = xmlHttp.responseXML;
					var smallTypeArr = xml.getElementsByTagName("smalltype");

					for (var i = 0; i < smallTypeArr.length; i++) {
						var nid = smallTypeArr[i].childNodes[0].childNodes[0].nodeValue;
						var sname = smallTypeArr[i].childNodes[1].childNodes[0].nodeValue;
						var opt = new Option(sname, nid);
						smallType.add(opt);
					}
				}
			}
		};
		xmlHttp.send(null);
	}
	function loadFrames(i) {
		if (i == 1) {
			parent.mainleft.location = '../user/main.jsp';
			parent.mainright.location = '../user/imgShow.jsp';
		} else if (i == 2) {
			parent.mainleft.location = '../user/userCenter.jsp';
			parent.mainright.location = '../user/orderShow.jsp';
		} else if (i == 3) {
			parent.mainleft.location = '../user/main.jsp';
			parent.mainright.location = '../user/orderShow.jsp';
		} else if (i == 4) {
			parent.mainleft.location = '../user/main.jsp';
			parent.mainright.location = '../user/show.jsp';
		}
	}
</script>
</head>

<body>
	<div style="margin-top: 15px">
		<form id="form1" name="form1" method="post" action="../user/show.jsp" target="mainright">
			<table  width="1200" height="155" align="center"
				cellpadding="0" cellspacing="0">
				<tr valign="bottom">
					<th width="265" height="63" align="center"><input name="" type="image"
						src="../img/21.jpg" width="200px"  height="100px" /></th>
					<th width="84" height="63" align="center"
						background="../img/over_b_bg.png" scope="col"><a
						href="javascript:;" onclick="loadFrames(1);">首页</a></th>
					<th width="84" background="../img/norm_b_bg.jpg" scope="col"><a
						href="javascript:;" onclick="loadFrames(2);">用户中心</a></th>
					<th width="84" background="../img/norm_b_bg.jpg" scope="col"><a
						href="../user/orderShow.jsp" target="mainright">我的订单</a></th>
					<th width="111" scope="col"><a href="../CarServlet" title="进入购物车"
						target="mainright"> <input name="" type="image"
							src="../img/top_cart.gif" />购物车
					</a></th>
					<th width="95" scope="col"><a href="../login.jsp"
						target="mainright">登陆</a></th>
					<th width="78" align="left" scope="col"><a
						href="../enroll.jsp" target="mainright">注册</a></th>
					<th width="100" align="left" scope="col"><a href="../login.jsp?slever=1"
						target="_parent">后台管理</a></th>
					<th width="165" align="left" scope="col"><a href="#"
						target="_parent">签到</a></th>

				</tr>
				<tr>
					<td id="tdid" height="90" colspan="9" align="center"><label>商品名称:
							<input type="text" name="sname" />
					</label> <select id="bigType" name="nmaxid" onchange="fun1();">
							<option value="-1">==请选择==</option>
							<%
								McTypeDAOImpl mcTypeCRUDImpl = new McTypeDAOImpl();
													List<McTypeBean> allBigTypes = mcTypeCRUDImpl.queryByNpid(0);
													for (McTypeBean typeBean : allBigTypes) {
							%>
							<option value="<%=typeBean.getNid()%>"><%=typeBean.getSname()%></option>
							<%
								}
							%>
					</select> 
					<select id="smallType" name="nminid" style="width: 83px; "></select>
						<a href="javascript:;" onclick="document.forms[0].submit();" target="mainright"><img src="../img/search.gif" alt="搜索商品" />搜索</a></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>